using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Barrage : MonoBehaviour
{
    Vector3 movement;
    public float minSpeed=4;
    public float maxSpeed=10;
    public float minScale=0.4f;
    public float maxScale=1.3f;

    // Start is called before the first frame update
    void Start()
    {
        movement.x = Random.Range(minSpeed, maxSpeed);
        transform.localScale *= Random.Range(minScale, maxScale);
    }

    // Update is called once per frame
    void Update()
    {
        if (!Global.instance.StartFlag)
        {
            Destroy(gameObject);
        }
        MoveBarrage();
    }

    void MoveBarrage()
    {
        transform.position -= movement * Time.deltaTime;
        if (transform.position.x < -11.2f)
        {
            Destroy(gameObject);
        }
        
    }
}
